import java.util.Map;
import java.util.TreeMap;

/**
 * Author: Daniel Michalski
 * Date: 10.03.13
 */

public class TreeMapDemo {
    public static void main(String[] args) {
        TreeMap<String, Double> tm = new TreeMap<>(new TComp());

        tm.put("Jan Kowalski", new Double(3434.34));
        tm.put("Piotr Nowak", new Double(123.22));
        tm.put("Joanna Bąk", new Double(1978.00));
        tm.put("Rafał Brzęczyszczykiewicz", new Double(99.22));
        tm.put("Tomek Nowak", new Double(-19.08));

        for (Map.Entry<String, Double> entry : tm.entrySet()) {
            System.out.print(entry.getKey() + ": ");
            System.out.println(entry.getValue());
        }

        double balance = tm.get("Jan Kowalski");
        tm.put("Jan Kowalski", balance + 1000);

        System.out.println("Nowy stan Jana Kowalskiego: " +
                           tm.get("Jan Kowalski"));
    }
}
